package com.itheima;

import com.itheima.pojo.Teacher;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SpringbootIocHomeworkApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootIocHomeworkApplication.class, args);
    }

    /**
     * 通过@Bean创建的Bean对象默认是方法名
     * 一般用于自动配置第三方对象的连接信息对象,例如 阿里云OSS
     * @return
     */
    @Bean("zhangsan")
    Teacher teacher1aaaaa(){
        Teacher teacher = new Teacher();
        teacher.setAge(8);
        teacher.setName("teacher1");
        return teacher;
    }
    @Bean("lisi")
    Teacher teacher2(){
        Teacher teacher = new Teacher();
        teacher.setAge(88);
        teacher.setName("teacher2");
        return teacher;
    }

}
